{extend name="index/public" /}

{block name="content"}
<form class="layui-form" action="" id="searchBox">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <select name="admin_id" id="admin_id" lay-search="" lay-filter="admin_id">
                <option value="">全部（管理员名称）</option>
                {volist name="admin_id" id="vo"}
                <option value="{$vo.id}">{$vo.remark}</option>
                {/volist}
            </select>
        </div>
    </div>
</form>

<table id="tableBox" lay-filter="tableBox"></table>
{/block}

{block name="css"}
{/block}

{block name="js"}
<script>
    layui.use('table', function(){
        var table = layui.table
            ,$ = layui.$
            ,form = layui.form
            ,load = null
            ,active = {
                reload: function () {
                    var admin_id = $('#admin_id').val();

                    table.reload('tableId', {
                        page: {curr: 1}
                        ,where: {admin_id:admin_id}
                        ,height: 'full-100'
                    })
                },
            };

        //表格初始化
        table.render({
            elem: '#tableBox'
            ,height: 'full-100'
            ,url: '{:url("SystemRecord/index")}'
            ,page: true
            ,limit:20
            ,limits:[20,40,60,80]
            ,loading:true
            ,id:'tableId'
            ,done: function (res, curr, count) {
                layer.close(load);
                $('#layui-loading').hide();
            }
            ,cols: [[
                {type:'checkbox', fixed: 'left'}
                ,{field:'id', title: 'ID', width: 60, sort:true}
                ,{field:'admin_id', title: '操作人员', width: 200, sort:true}
                ,{field:'url', title: '操作接口', width: 200, sort:true}
                ,{field:'input', title: '操作参数', width: 600, sort:true}
                ,{field:'add_time', title: '操作时间', width: 200, sort:true}
            ]]
        });

        //监听搜索下拉菜单
        form.on('select(admin_id)', function(data){
            load = layer.load();
            active['reload'].call(this);
        });
    });
</script>
{/block}